package com.sixeco.apigetway.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sixeco.apigetway.common.CommonVar;

import io.netty.channel.Channel;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpRequest;

/**
 * 处理表单的controller
 * 
 * @author tianzhenjiu
 *
 */
public class FormController extends Controller {


	Logger logger=LoggerFactory.getLogger(getClass());
	
	@Override
	public void service(Channel requestChannel, HttpRequest request) {

		if (!(request instanceof FullHttpRequest)) {
			requestChannel.writeAndFlush(CommonVar.createBadRequest(null));
			return;
		}
		
	
		logger.info("路径->{}",request.uri());
		requestChannel.attr(CommonVar.Proxy.lastRequestUri).set(request.uri());
		requestChannel.attr(CommonVar.Proxy.lastRequestTime).set(System.currentTimeMillis());
		requestChannel.attr(CommonVar.Proxy.requstCount).get().incrementAndGet();
	
		super.routeData(requestChannel,(FullHttpRequest) request);

	}

	

}
